package com.example.mapper;

import com.example.pojo.DTO.FlightsDTO;
import com.example.pojo.FlightBean;
import com.example.pojo.Flights;
import com.example.pojo.VO.AirlinesVO;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface FlightMapper {

    List<Flights> getAllFightsInfo();
@Delete("delete from flights where id=#{id}")
    Integer deleteFlightById(@Param("id")Integer id);
@Select("select*from flights where id=#{id}")
Flights getFlightById(@Param("id")Integer id);
@Update("update flights set airline_id=#{airlineId},flight_number=#{flightNumber},departure_city=#{departureCity},arrival_city=#{arrivalCity},aircraft_type=#{aircraftType},gate_number=#{gateNumber},air_img=#{airImg},departure_time=#{departureTime},arrival_time=#{arrivalTime} where id=#{id}")
    Integer updateFlightById(FlightBean flightBean);
@Insert("insert into flights values (default,#{airlineId},#{flightNumber},#{departureCity},#{arrivalCity},#{aircraftType},#{gateNumber},#{airImg},#{departureTime},#{arrivalTime}) ")

    Integer addFlight(FlightBean flightBean);
    @Select("select id ,name from airlines")
    List<AirlinesVO> getAirlinesName();


    List<Flights> getFightsByCondition(@Param("flightsDTO") FlightsDTO flightsDTO);
}
